package foodmaterial.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import foodmaterial.action.valid.ObjectNullValid;
import foodmaterial.utils.Constants;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public class PurchaseBill implements Serializable {
    private static final long serialVersionUID = 1607154374535430609L;

    private Long id;
    @JsonFormat(pattern=Constants.DEFAULT_DATE_FORMAT,timezone="GMT+8")
    @ObjectNullValid(message = "采购日期不能为空")
    @Past(message ="采购日期不能大于当前系统日期")
    private Date purchaseDate ; //'采购日期',
    private BigDecimal amountOfMoney;//'总金额',
    private Boolean payStatus;//'支付状态',
    private Long purchasePerson; //'采购人',
    private String purchasePersonName ;
    @ObjectNullValid(message = "供应商不能为空")
    private Long supplierId; //'供应商',
    private String supplierName ;
    @JsonFormat(pattern=Constants.DEFAULT_DATE_TIME_FORMAT,timezone="GMT+8")
    private Date operationDate; //'操作时间',
    private Long operationPerson; //'电脑操作人'
    private String operationPersonName ;
    @JsonFormat(pattern=Constants.DEFAULT_DATE_TIME_FORMAT,timezone="GMT+8")
    private Date lastUpdateTime ;
    private Long lastUpdatePerson ;
    private String lastUpdatePersonName ;
    private Boolean status = Boolean.FALSE;
    private String billType = Constants.PURCHASE_BILL_TYPE_BATCH ;
    @Length(max=200,message = "备注最长{max}个字符")
    private String remark ;
    private Boolean updateSelf ;//表示只修改自己的采购单
    @Size(min= 1,message = "最少有一条食材采购明细")
    @Valid
    private List<PurchaseBillDetails> details;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getPurchaseDate() {
        return purchaseDate;
    }

    public void setPurchaseDate(Date purchaseDate) {
        this.purchaseDate = purchaseDate;
    }

    public BigDecimal getAmountOfMoney() {
        return amountOfMoney;
    }

    public void setAmountOfMoney(BigDecimal amountOfMoney) {
        this.amountOfMoney = amountOfMoney;
    }

    public Boolean getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(Boolean payStatus) {
        this.payStatus = payStatus;
    }

    public Long getPurchasePerson() {
        return purchasePerson;
    }

    public void setPurchasePerson(Long purchasePerson) {
        this.purchasePerson = purchasePerson;
    }

    public Long getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(Long supplierId) {
        this.supplierId = supplierId;
    }

    public Date getOperationDate() {
        return operationDate;
    }

    public void setOperationDate(Date operationDate) {
        this.operationDate = operationDate;
    }

    public Long getOperationPerson() {
        return operationPerson;
    }

    public void setOperationPerson(Long operationPerson) {
        this.operationPerson = operationPerson;
    }

    public String getPurchasePersonName() {
        return purchasePersonName;
    }

    public void setPurchasePersonName(String purchasePersonName) {
        this.purchasePersonName = purchasePersonName;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public String getOperationPersonName() {
        return operationPersonName;
    }

    public void setOperationPersonName(String operationPersonName) {
        this.operationPersonName = operationPersonName;
    }

    public Date getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(Date lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    public Long getLastUpdatePerson() {
        return lastUpdatePerson;
    }

    public void setLastUpdatePerson(Long lastUpdatePerson) {
        this.lastUpdatePerson = lastUpdatePerson;
    }

    public String getLastUpdatePersonName() {
        return lastUpdatePersonName;
    }

    public void setLastUpdatePersonName(String lastUpdatePersonName) {
        this.lastUpdatePersonName = lastUpdatePersonName;
    }

    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    public String getBillType() {
        return billType;
    }

    public void setBillType(String billType) {
        this.billType = billType;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Boolean getUpdateSelf() {
        return updateSelf;
    }

    public void setUpdateSelf(Boolean updateSelf) {
        this.updateSelf = updateSelf;
    }

    public List<PurchaseBillDetails> getDetails() {
        return details;
    }

    public void setDetails(List<PurchaseBillDetails> details) {
        this.details = details;
    }
}
